max_size=10
arr = {}

def partition(arr, start, end):
	for x in arr:
		print x	
	pivot = arr[start]	#considering the pivot to be the first element
	low = start + 1
	high = end
	print "low =", low, "and high =", high	
	while low < high:
		while arr[low] <= pivot:
			low = low + 1
		while arr[high] > pivot:
			high = high - 1
		#swap
		if low < high:		
			arr[low], arr[high] = arr[high], arr[low]
	#swap the high one with the pivot
	arr[start] = arr[high]
	arr[high] = pivot
	
	return (high, arr)

def quicksort(arr, start, end):
	if start < end:
		pivot, arr = partition(arr, start, end)
		arr = quicksort(arr, start, pivot - 1)
		arr = quicksort(arr, pivot + 1, end)
	return arr

for i in range(max_size):
	print "Enter value #", i
	arr[i] = int(raw_input())

print "performing quicksort"

quicksort(arr, 0, max_size - 1)

print "output:"

for i in range(max_size):
	print arr[i]

print arr
print "Completed"
